<html>
<body>
Reports <code>if</code> statements that can be replaced with <code>switch</code> statements.
<p>The replacement result is usually shorter and clearer.</p>
<p><b>Example:</b></p>
<pre><code>
  void test(String str) {
    if (str.equals("1")) {
      System.out.println(1);
    } else if (str.equals("2")) {
      System.out.println(2);
    } else if (str.equals("3")) {
      System.out.println(3);
    } else {
      System.out.println(4);
    }
  }
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
  void test(String str) {
    switch (str) {
      case "1" -&gt; System.out.println(1);
      case "2" -&gt; System.out.println(2);
      case "3" -&gt; System.out.println(3);
      default -&gt; System.out.println(4);
    }
  }
  </code></pre>
<!-- tooltip end -->
<p>This inspection only reports if the language level of the project or module is 7 or higher.</p>
<p>Use the <b>Minimum number of 'if' condition branches</b> field to specify the minimum number of <code>if</code> condition branches
  for an <code>if</code> statement to have to be reported. Note that the terminal <code>else</code> branch (without <code>if</code>) is not counted.</p>
<p>
Use the <b>Suggest switch on numbers</b> option to enable the suggestion of <code>switch</code> statements on
primitive and boxed numbers and characters.
<p>
Use the <b>Suggest switch on enums</b> option to enable the suggestion of <code>switch</code> statements on
<code>enum</code> constants.
<p>
  Use the <b>Only suggest on null-safe expressions</b> option to suggest <code>switch</code> statements that can't introduce a <code>NullPointerException</code> only.
</p>
</body>
</html>